package com.fw.ui.util.comparator;

import java.util.Comparator;

public class StringComparator implements Comparator<String> {

    private boolean ignoreCase;

    public StringComparator() {
    }

    public StringComparator(boolean ignoreCase) {
	this.ignoreCase = ignoreCase;
    }

    @Override
    public int compare(String str1, String str2) {
	if (ignoreCase) {
	    return str1.compareToIgnoreCase(str2);
	} else {
	    return str1.compareTo(str2);
	}
    }

}
